from rest_framework_simplejwt.serializers import TokenObtainPairSerializer

#自定义登录成功后返回字段

class CustomTokenSerializer(TokenObtainPairSerializer):
    def validate(self,attrs):
        data = super().validate(attrs)
        data.update({
            'username':self.user.username,
            'user_id':self.user.id,
            'email':self.user.email
            })
        return data